<template>
  <div>
    <el-container>
      <el-header>
        <TopMenu />
      </el-header>
      <el-container class="layout-container-demo"
        ><!--style="height: 100%"-->
        <el-aside width="200px;" style="margin-top: 0.5%; max-width: 250px">
          <el-scrollbar>
            <el-menu @select="doSelect" :default-active="activeIdx">
              <el-menu-item index="/user/index">
                <template #title>
                  <el-icon>
                    <message />
                  </el-icon>
                  账户总览
                </template>
              </el-menu-item>
              <el-menu-item index="/user/goodsList">
                <template #title>
                  <el-icon>
                    <icon-menu />
                  </el-icon>
                  我的上架
                </template>
              </el-menu-item>
              <el-menu-item index="/user/carbonCountList">
                <template #title>
                  <el-icon>
                    <List />
                  </el-icon>
                  碳核算记录
                </template>
              </el-menu-item>
              <el-menu-item index="/user/carbonTradeList">
                <template #title>
                  <el-icon>
                    <List />
                  </el-icon>
                  碳交易记录
                </template>
              </el-menu-item>
              <el-menu-item index="/user/enterpriseCertification">
                <template #title>
                  <el-icon>
                    <FolderChecked />
                  </el-icon>
                  企业认证
                </template>
              </el-menu-item>
              <el-menu-item index="/user/enterpriseEdit">
                <template #title>
                  <el-icon>
                    <Edit />
                  </el-icon>
                  企业资料编辑
                </template>
              </el-menu-item>
              <el-menu-item index="/user/publicmsg">
                <template #title>
                  <el-icon>
                    <Message />
                  </el-icon>
                  消息
                </template>
              </el-menu-item>
              <el-menu-item index="/user/maskIndex">
                <template #title>
                  <el-icon>
                    <WalletFilled />
                  </el-icon>
                  钱包
                </template>
              </el-menu-item>
            </el-menu>
          </el-scrollbar>
        </el-aside>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts" setup>
import { Edit, Menu as IconMenu, Message, Setting, WalletFilled } from '@element-plus/icons-vue'
import TopMenu from '@/components/Menu/TopMenu.vue'
import { useRoute, useRouter } from 'vue-router'
import { ref } from 'vue'

const router = useRouter()
const route = useRoute()
let activeIdx = ref()
const doSelect = (index: any) => {
  console.log('index:  ', index)
  activeIdx.value = index
  router.push({
    path: index
  })
}

activeIdx.value = route.path
router.afterEach((to, from) => {
  activeIdx.value = to.path
  console.log('个人中心的侧栏标签', activeIdx.value)
})
const item = {}
</script>
<style scoped></style>
<!--<style scoped>-->
<!--.layout-container-demo .el-aside {-->
<!--  color: var(&#45;&#45;el-text-color-primary);-->
<!--  background: var(&#45;&#45;el-color-primary-light-8);-->
<!--  height: 100%;-->
<!--}-->

<!--.layout-container-demo .el-menu {-->
<!--  border-right: none;-->
<!--}-->

<!--.layout-container-demo .el-main {-->
<!--  padding: 0;-->
<!--}-->

<!--.container {-->
<!--  display: flex;-->
<!--  width: 100%;-->
<!--  flex-direction: column;-->
<!--}-->

<!--.container .top {-->
<!--  display: flex;-->
<!--  height: 80px;-->
<!--  width: 100%;-->
<!--  border: 1px solid orange;-->
<!--}-->

<!--.center {-->
<!--  display: flex;-->
<!--  flex-direction: column;-->
<!--}-->

<!--.footer {-->
<!--  flex: 1;-->
<!--  width: 100%;-->
<!--  height: 230px;-->
<!--}-->

<!--.container .top .left {-->
<!--  display: flex;-->
<!--  flex-direction: column;-->
<!--  height: 100%;-->
<!--  width: 70px;-->
<!--  justify-content: center;-->
<!--  /* background: red; */-->
<!--  text-align: center;-->
<!--  color: red;-->
<!--}-->

<!--.container .top .item {-->
<!--  flex: 1;-->
<!--  font-size: 13px;-->
<!--  line-height: 80px;-->
<!--  /* background: red; */-->
<!--}-->

<!--.container .top .right {-->
<!--  float: right;-->
<!--  line-height: 80px;-->
<!--  margin-right: 10px;-->
<!--}-->

<!--.center .ctop {-->
<!--  height: 100px;-->
<!--  display: flex;-->
<!--  margin-top: 15px;-->
<!--}-->

<!--.center .ctop .exit {-->
<!--  display: block;-->
<!--  height: 50px;-->
<!--  margin-top: 25px;-->
<!--  line-height: 50px;-->
<!--  border: 1px solid red;-->
<!--  background-color: rgb(255, 238, 221);-->
<!--}-->

<!--.center .ctop div {-->
<!--  height: 100px;-->
<!--  line-height: 100px;-->
<!--  text-align: center;-->
<!--}-->

<!--.center .ctop div:nth-child(1) {-->
<!--  width: 150px;-->
<!--}-->

<!--.center .ctop div:nth-child(2) {-->
<!--  flex: 1;-->
<!--}-->

<!--.center .ctop div:nth-child(3) {-->
<!--  width: 100px;-->
<!--}-->

<!--.center .cbottom {-->
<!--  display: flex;-->
<!--  justify-content: space-between;-->
<!--}-->

<!--.center .cbottom div {-->
<!--  width: 48%;-->
<!--  background-color: rgb(255, 232, 219);-->
<!--  height: 157px;-->
<!--  margin-top: 15px;-->
<!--  border-radius: 10px;-->
<!--}-->

<!--.footer .fcontainer {-->
<!--  height: 200px;-->
<!--  margin-top: 30px;-->
<!--  display: flex;-->
<!--  justify-content: space-between;-->
<!--}-->

<!--.footer .fcontainer > div {-->
<!--  width: 20%;-->
<!--  height: 200px;-->
<!--}-->

<!--.footer .fcontainer .ftop {-->
<!--  display: flex;-->
<!--  font-size: 13px;-->
<!--}-->

<!--.footer .fcontainer .ftop i {-->
<!--  width: 25%;-->
<!--  height: 40px;-->
<!--  line-height: 40px;-->
<!--  text-align: center;-->
<!--  font-size: 24px;-->
<!--}-->

<!--.footer .fcontainer .ftop span {-->
<!--  width: 75%;-->
<!--  height: 40px;-->
<!--  line-height: 40px;-->
<!--  text-align: center;-->
<!--  font-weight: bold;-->
<!--}-->

<!--.footer .fcontainer .fbottom div:nth-child(1) {-->
<!--  height: 120px;-->
<!--  background-color: rgb(231, 231, 231);-->
<!--  border-radius: 10px;-->
<!--}-->

<!--.footer .fcontainer .fbottom div:nth-child(2) {-->
<!--  height: 40px;-->
<!--  background: pink;-->
<!--  line-height: 40px;-->
<!--  text-align: center;-->
<!--  font-size: 14px;-->
<!--  margin-top: 10px;-->
<!--  border-radius: 10px;-->
<!--  color: white;-->
<!--}-->

<!--.footer .fcontainer .fbottom i {-->
<!--  display: block;-->
<!--  width: 100%;-->
<!--  height: 80px;-->
<!--  line-height: 80px;-->
<!--  text-align: center;-->
<!--  font-size: 48px;-->
<!--}-->

<!--.footer .fcontainer .fbottom span {-->
<!--  display: block;-->
<!--  width: 100%;-->
<!--  height: 40px;-->
<!--  line-height: 40px;-->
<!--  text-align: center;-->
<!--  font-size: 14px;-->
<!--}-->
<!--</style>-->
